﻿using CPN.PJN.Common.Logging.LogWriters;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace CPN.PJN.Common.Logging.UnitTests
{
    /// <summary>
    /// Summary description for LoggingUnitTest
    /// </summary>
    [TestClass]
    public class LoggingUnitTest
    {
        /// <summary>
        /// Use ClassInitialize to run code before running the first test in the class
        /// </summary>
        /// <param name="testContext"></param>
        [ClassInitialize()]
        public static void InitializeUnitTest(TestContext testContext)
        {
            Logger.Instance.Initialize(new EnterpriseLibraryLogWriter());
        }

        /// <summary>
        /// Vérification du Bon Fonctionnement du Logger
        /// </summary>
        [TestMethod]
        public void TestMethodWrite()
        {
            Logger.Instance.Write("Test log");
        }

        /// <summary>
        /// Vérification du Bon Fonctionnement du Logger
        /// </summary>
        [TestMethod]
        public void TestMethodWritewithCategoryAndSeverity()
        {
            Logger.Instance.Write("Test information", LoggerCategory.GENERAL, LoggerSeverity.Information);
            Logger.Instance.Write("Test Log Debug", LoggerCategory.GENERAL, LoggerSeverity.Verbose);
            Logger.Instance.Write("Test Log Erreur", LoggerCategory.GENERAL, LoggerSeverity.Error);
            Logger.Instance.Write("Test Log Fatal", LoggerCategory.GENERAL, LoggerSeverity.Critical);
        }
    }
}
